class Ground {
    constructor(game) {
        this.game = game
        this.name = 'ground'
        this.setUp()
    }

    static new = function(game) {
        return new Ground(game)
    }

    setUp() {
        this.skip = 3
        this.grounds = []
        for (let i = 0; i < 30; i++) {
            const g = new GuaImage(this.game, 'ground') 
            g.x = i * 19
            g.y = 325
            this.game.scene.addElement(g)
            this.grounds.push(g)
            
        }
    }

    update() {
        var offset = -5
        if (this.skip == 0) {
            this.skip = 3
            offset = 10
        }
        for (var i = 0; i < 30; i++) {
            this.grounds[i].x += offset
        }
        this.skip--
    }
    draw() {

    }

}